package org.easyframework.frm.cfg;

import java.util.Calendar;

public enum DataType {

	STRING ("string", ""),
	INT ("int", 0),
	DOUBLE ("double", 0),
	DATE ("date", Calendar.getInstance().getTime());
	
	private Object defaultValue;
	
	private String displayType;
	
	private DataType (String displayType, Object defaultValue) {
		
		this.setDisplayType(displayType);
		
		this.defaultValue = defaultValue;
		
	}
	
	public static DataType getByDisplayType (String displayType) {
		
		if (displayType.equalsIgnoreCase("string")) {

			return STRING;

		} else if (displayType.equalsIgnoreCase("int")) {

			return INT;

		} else if (displayType.equalsIgnoreCase("double")) {

			return DOUBLE;

		} else if (displayType.equalsIgnoreCase("date")) {

			return DATE;

		}
		
		return null;
	}

	/**
	 * @return the defaultValue
	 */
	public Object getDefaultValue() {
		return defaultValue;
	}

	/**
	 * @param defaultValue the defaultValue to set
	 */
	public void setDefaultValue(Object defaultValue) {
		this.defaultValue = defaultValue;
	}

	/**
	 * @return the displayType
	 */
	public String getDisplayType() {
		return displayType;
	}

	/**
	 * @param displayType the displayType to set
	 */
	public void setDisplayType(String displayType) {
		this.displayType = displayType;
	}

}
